package proxy;

import service.OperationService;
//代理
public class OperationServiceProxy implements OperationService {
    private final OperationService operationService;

    public OperationServiceProxy(OperationService operationService) {
        this.operationService = operationService;
    }

    @Override
    public int getResult(int num1, int num2) {
        // 添加前置日志
        System.out.println("Calling method: getResult with parameters: " + num1 + ", " + num2);

        // 调用实际方法
        int result = operationService.getResult(num1, num2);

        // 添加后置日志
        System.out.println("Method: getResult returned: " + result);

        return result;
    }
}
